package com.yanqu.road.server.manger.player.impl;

import com.yanqu.road.entity.event.EventTriggerArgs;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.advertisement.AdvertisementActivityModule;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.server.manger.player.IPlayInfoChangeListener;

/**
 * 在线时长触发广告礼包
 */
public class PlayerOnlineTimeChangeForAd implements IPlayInfoChangeListener {

    @Override
    public void notify(int eventType, long userId, EventTriggerArgs args) {

        GamePlayer onlinePlayer = GamePlayerMgr.getOnlinePlayer(userId);
        if(onlinePlayer != null) {
            long minute = (long) args.getArgs();
            onlinePlayer.getModule(AdvertisementActivityModule.class).touchOnlineTimeAd(minute);
        }
    }
}
